home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Professional Soft Collection 1.02
/
Professional Soft Collection 1.02.iso
/
winutils
/
wingauge.zip
/
WINGAUGE.DOC
< prev
next >
Wrap
Text File
|
1993-04-08
|
8KB
|
178 lines
*************************************************************************
* *
* CrossSwords presents... *
* *
*------------------========================================-------------*
* WinMeter - Windows system features gauge *
*------------------========================================-------------*
* *
* Copyright (C) by CrossSwords, 1992, 1993 *
* *
* Author: Alexander A. Shultz *
* *
*************************************************************************
* *
* Environment: Microsoft Windows 3.0 *
* Language: Borland C *
* Tools: Borland C++ 2.0 *
* *
*************************************************************************
To my wife and son with love.
One day I sat in a library looking through some computer journals.
Suddenly one article named "Measure your machine's activity and learn how
to use OS/2 threads with CPUMETER" by Bob Chiverton (from Microsoft
Systems Journal, vol.5 No.6, pp.49-60) was striking for me. This is its
beginning:
"It's a miracle my first sports car didn't explode. It has only two
speeds -- legal and illegal. But I was 19, it was summer, and the car
wasn't really mine. I borrowed it from my friend, Roman. And if Roman
knew I pushed the tachometer into the redzone in every gear including
reverse, you wouldn't be reading this now."
"I don't redline tachometers anymore, now that I pay for my auto
repairs, but I still enjoy speed -- especially in my computers. That's
why I wrote CPUMETER, an OS/2 Presentation Manager program that shows
when I'm redlining the CPU."
Yes, Bob, you are lucky. Not only in car driving, but in programming
too. Well, but OS/2 is *really* multithread system. And can *I* write
anything like it for Microsoft Windows? My programmer's honor was on
stake, and I've started to program WinMeter.
When WinMeter was ready, I've found that there are some more features
to measure in Windows. So WinMeter had to grow, and now it is WinGauge -
a tool for measuring Windows features.
Of course, Windows isn't OS/2, and WinGauge isn't a precise tool,
but not only a toy too. Moreover, if you will be glad to see how it works,
or if my program can help you to write your own ones, then I didn't in
vain read Bob's article and "licked" my program.
You can run WinGauge by three different ways:
1) You can type full path to WinGauge.exe in "File|Run..." dialog
box and press ENTER. No parameter is needed.
2) You can put this program (using "File|New..." menu command) to
one of your groups in Program Manager and then blast off it by
the mouse or the keyboard.
3) You can add full path to WinGauge.exe to "Load" or "Run"
sections of WIN.INI file to start WinMeter during boot process
of Windows.
If there are too many clocks or timers in Windows now, WinGauge wait
while you close some applications and free one Windows' timer for it.
You can run up to three instances of WinGauge to see all its panels.
If you try to run fourth instance of Wingauge, it shows a message box and
hilites one of currently active WinGauge panel.
WinGauge can run in two modes.
First is "Full-screen mode", when you can see all three panels
worked. This mode is start mode, if you "run" (not "load") WinGauge. In
this mode WinGauge shows you: 1) WinMeter panel -- one that shows you the
percentage of system overloading; 2) ResMeter panel -- one that shows you
free system resources value, and 3) MemMeter panel -- one that shows you
total amount of free memory. Moreover, you can see number of loaded tasks
in Windows to the right of WinMeter panel.
If screen space is you critical resource, you can minimize WinGauge
and see how it works in the second mode -- "Panel mode". To do this
simply push Minimize button of WinGauge window. BUT. If you do so, you'll
see only 'integrated' icon of WinGauge -- the icon, not the working panel!
So you must choose the panel to demonstrate in Panel mode before you
switch to it.
There is two ways to choose active panel in WinGauge: one with the
keyboard, another -- with the mouse. With the keyboard you can use arrow
keys, [Tab] and [Shift-Tab] to move hilite (border around the panel) and
press [Space] or [Enter] to select hilited panel. If there was selected
panel, it is deselected. If you don't want to choose any panel, select
current active panel ones more -- it will be deselected. With the mouse
you can simply click left mouse button on panel icon. To deselect active
panel press button ones more. With the mouse you can shorter the process
of selecting and minimizing WinGauge. Make a double-click on one panel,
and you'll select it and minimize simultaneously.
Selected panel is draw like "deepen" button.
The "About Wingauge..." dialog box (called from System menu of
WinGauge window) is modified when one of the panels is selected. The
description of selected panel with its icon appear in addition to standard
program and author information.
Users of Windows 3.10 or greater can see one more item in the System
menu. It is well-known "Always on Top" item to make your WinGauge panel(s)
visible all time. To change top status of WinGauge select this menu item.
Checkmark near it helps you to determine weather it is active.
Of course, you can shut down WinGauge any time you want to do it,
but I hope you will never want to shut up WinGauge!
Sincerely Yours
Alexander A. Shultz.
WinGauge is FreeWare, so you are free to use or distribute it with
only few restrictions:
WinGauge must be distributed in absolutely unmodified form,
including program, documentation, and other files.
WinGauge may not be included to any other product for any
reason whatsoever without a license from CrossSwords.
No charge or payment may be levied or accepted for WinGauge.
If you want to use WinGauge or some of its code in your products,
please contact the author to get permission.
If you find WinGauge funny or usable, you can support me by sending
some fee. Contact with author to know how to do it.
To contact with author,
phone: +7-095-203-6690, LPS-Inter (weekdays)
+7-095-530-3822 (weekends)
E-mail: FIDO 2:5020/40.17
Please use Russian or English in you messages.
P.S. For men who like to make one's way through other's code.
The code itself is very simple, but there are some tricks here. The
'trickiest' tricks are in WinMeter module code.
The main idea of WinMeter is in Windows' timer message handling.
This is a low-priority message in Windows. So when your program (or task)
has only WM_PAINT and WM_TIMER messages in queue, and there is any task
that have other messages in queue, Windows switches to it. Also, Windows
don't accumulate non-proceeded WM_TIMER messages, but discards them from
program's queue. So the more WM_TIMER messages are gone, the more tasks
are in system. This is the main measure in WinMeter.
Other tricks are for pretty looking. They are: cursor handling
during icon dragging, 'About...' dialog box background color, and
preventing from icon opening. They all are standard, and you can find
explanation in well-known book by Charles Petzold or in inline help of
Borland C++, or in Microsoft SDK 3.0 help system.
For those who use Microsoft Windows 3.10 or greater, I have added
"Always on Top" option in system menu of WinGauge. It is not trick, but
the new technique, and I want to hilite this fact.
Hoo, I've missed one interesting thing! Look into INTEGR1.C file --
there are no well-known Windows' loop here! Things are very simple -- I
use DialogBox as a main window, so I need not to use this loop.
I hope that some comments I've added to program listing can help you
to walk into my code. Good luck!